<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jquery.js"></script>
</head>
<body>
    <form action="">
    <p>账号<input type="text"></p>
    <p>密码<input type="password"></p>
    <p>性别<input type="radio" checked name="sex">男<input type="radio" name="sex">女</p>
    <p>
        爱好:
        <input type="checkbox" name="hobby" value="男">男
        <input type="checkbox" name="hobby" value="女">女
        <input type="checkbox" name="hobby" value="钱">钱
        <input type="checkbox" name="hobby" value="车">车
        <input type="checkbox" name="hobby" value="房">房
    </p>
    <p><button type="submit">提交</button></p>
    </form>
    <script>
        document.forms[0].onsubmit=function(){
            var $txt=$(":text").val();
            console.log($txt);

            var hobby=[];
            var cbxs=$(":checkbox:checked");
            for(var i=0;i<cbxs.length;i++){
                hobby.push(cbxs.eq(i).val())
            }
            console.log(hobby);

            console.log($(":radio:checked").val());
            return false;
        }
    </script>
</body>
</html>